package bean;

import java.util.Collections;
import java.util.LinkedList;
import java.util.List;

public class quanpailie {    //全排列算法
        static int m;
        List<StringBuffer> list=new LinkedList<>();
        public  void pai(int a[],int k){   //(k重0开始)
            int t;
            if(k==3){
                StringBuffer stringBuffer=new StringBuffer();
                for(int i=0;i<3;i++){
                    stringBuffer.append(a[i]);
                }
                list.add(stringBuffer);
                return ;
            }
            for(int i=k;i<3;i++){
                {
                    t=a[i];
                    a[i]=a[k];
                    a[k]=t;
                }
                pai(a,k+1);
                {
                    t=a[i];
                    a[i]=a[k];
                    a[k]=t;   //回溯
                }
            }
        }
        public void  see(){
              System.out.println(list);
        }
        public List<StringBuffer> l(){
            Collections.sort(list);
            return list;
        }

}
